#!/bin/bash

# ===== Configuration =====
JAR_FILE="/ydcg/application/risk_control_application_v1.0.7.jar"           # Path to your JAR file (use absolute path if needed)
JVM_OPTS="-Xms512m -Xmx1024m"    # JVM parameters (adjust as needed)
LOG_DIR="logs"                   # Directory to store logs
# =========================

# Create log directory if it doesn't exist
mkdir -p "$LOG_DIR"

# Generate timestamped log filename
LOG_FILE="$LOG_DIR/app_$(date +'%Y-%m-%d_%H-%M-%S').log"

# Start the application
nohup java $JVM_OPTS -jar "$JAR_FILE" > "$LOG_FILE" 2>&1 &

# Display startup info
echo "=======> Application started!"
echo "=======> JVM parameters: $JVM_OPTS"
echo "=======> Log file: $LOG_FILE"
echo "=======> Process PID: $!"